﻿using System;
using System.Drawing;
using System.Globalization;
using System.Windows.Forms;

namespace OC
{
    public partial class WinMain : Form
    {
        public WinMain() => InitializeComponent();
        private readonly CultureInfo G = CultureInfo.GetCultureInfo("en-US");
        private void C_Tick(object sender, EventArgs e)
        { D.Text = DT; S.Text = ST; W.Text = WT; T.Text = TT; N.Text = NT; T.ForeColor = DateTime.Now.Second == 0 ? Color.Red : Color.Black; }
        private String DT => DateTime.Now.ToString("MMM. dd , yyyy", G);
        private String ST
        {
            get
            {
                switch (DateTime.Now.Day)
                {
                    case 1: case 21: case 31: return "st";
                    case 2: case 22: return "nd";
                    case 3: case 13: case 23: return "rd";
                    default: return "th";
                }
            }
        }
        private String WT => DateTime.Now.ToString("dddd zzz");
        private String TT => DateTime.Now.ToString("HH:mm:ss.fff", G);
        private String NT => DateTime.Now.ToString("HH:mm:ss", G);
        private void WinMain_Resize(object sender, EventArgs e)
        { if (WindowState != FormWindowState.Minimized) return; ShowInTaskbar = false; Hide(); N.Visible = true; }
        private void N_Click(object sender, EventArgs e)
        { N.Visible = false; ShowInTaskbar = true; Show(); WindowState = FormWindowState.Normal; }
    }
}
